import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入 组件
import LoginPage from '@/views/login/index.vue'
// 导入内容 父组件
import Layout from '@/views/layout/index.vue'
Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   redericte: '/login'
  // },
  {
    name: 'LoginPage',
    path: '/login',
    component: LoginPage
  }, {
    // name: 'Layout',
    path: '/',
    component: Layout,
    children: [{
      // name: 'home',
      path: '',
      component: () => import('@/views/home/index.vue')
    }, {
      name: 'response',
      path: '/response',
      component: () => import('@/views/response/index.vue')
    }, {
      name: 'video',
      path: '/video',
      component: () => import('@/views/video/index.vue')
    }, {
      name: 'my',
      path: '/my',
      component: () => import('@/views/my/index.vue')
    }]
  },
  {
    name: 'search',
    path: '/search',
    component: () => import('@/views/search/index.vue')
  },
  {
    name: 'article',
    path: '/article/:articleId',
    props: true,
    component: () => import('@/views/article/index.vue')
  },
  {
    name: 'userProfile',
    path: '/user/user_profile',
    component: () => import('@/views/user/user_profile.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
